package com.mdd.admin.service.royalty.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mdd.admin.service.royalty.AlipayRoyaltyAccountInfoService;
import com.mdd.common.entity.AlipayRoyaltyAccountInfo;
import com.mdd.common.enums.MerchantEnum;
import com.mdd.common.mapper.AlipayRoyaltyAccountInfoMapper;
import org.springframework.stereotype.Service;

/**
* @author DELL
* @description 【alipay_royalty_account_info(分账账号信息)】的数据库操作Service实现
* @createDate 2023-11-13 17:00:22
*/
@Service
public class AlipayRoyaltyAccountInfoServiceImpl extends ServiceImpl<AlipayRoyaltyAccountInfoMapper, AlipayRoyaltyAccountInfo>
    implements AlipayRoyaltyAccountInfoService {

    @Override
    public AlipayRoyaltyAccountInfo getSysAccountByOrganizationType() {
        LambdaQueryWrapper<AlipayRoyaltyAccountInfo> alipayRoyaltyAccountInfoWrapper=new LambdaQueryWrapper<>();
        alipayRoyaltyAccountInfoWrapper.eq(AlipayRoyaltyAccountInfo::getOrganizationType, MerchantEnum.PLATFORM_SYSTEM.getCode());
        return this.baseMapper.selectOne(alipayRoyaltyAccountInfoWrapper);
    }

    @Override
    public AlipayRoyaltyAccountInfo getAccountByMerchantId(Long merchantId) {
        LambdaQueryWrapper<AlipayRoyaltyAccountInfo> alipayRoyaltyAccountInfoWrapper=new LambdaQueryWrapper<>();
        alipayRoyaltyAccountInfoWrapper.eq(AlipayRoyaltyAccountInfo::getMerchantId, merchantId);
        return this.baseMapper.selectOne(alipayRoyaltyAccountInfoWrapper);
    }
}




